package cn.com.cpic.insurance.rulecheck.core.operator;

import cn.com.cpic.insurance.rulecheck.core.operator.impl.ListNotInListOperator;
import cn.com.cpic.insurance.rulecheck.core.operator.impl.NumberEqualOperator;
import cn.com.cpic.insurance.rulecheck.core.operator.impl.NumberGreaterThanOperator;
import cn.com.cpic.insurance.rulecheck.core.operator.impl.NumberLessThanOperator;
import cn.com.cpic.insurance.rulecheck.core.operator.impl.StringEqualOperator;
import cn.com.cpic.insurance.rulecheck.core.operator.impl.StringInListOperator;
import cn.com.cpic.insurance.rulecheck.core.operator.impl.StringNotEqualOperator;
import cn.com.cpic.insurance.rulecheck.core.operator.impl.StringNotInListOperator;

public class OperatorUtils {

	public static final int BOOLEAN_EQUAL = 10;
	public static final int BOOLEAN_NOT_EQUAL = 11;
	public static final int NUMBER_EQUAL = 20;
	public static final int NUMBER_NOT_EQUAL = 21;
	public static final int NUMBER_GREATER_THAN = 22;
	public static final int NUMBER_LESS_THAN = 23;
	public static final int NUMBER_GREATER_EQUAL = 24;
	public static final int NUMBER_LESS_EQUAL = 25;
	public static final int STRING_EQUAL = 30;
	public static final int STRING_NOT_EQUAL = 31;
	public static final int STRING_STARTS_WITH = 32;
	public static final int STRING_ENDS_WITH = 33;
	public static final int STRING_CONTAINS = 34;
	public static final int STRING_IN_LIST = 35;
	public static final int STRING_NOT_IN_LIST = 36;
	public static final int DATE_EQUAL = 40;
	public static final int DATE_NOT_EQUAL = 41;
	public static final int DATE_GREATER_THAN = 42;
	public static final int DATE_LESS_THAN = 43;
	public static final int DATE_GREATER_EQUAL = 44;
	public static final int DATE_LESS_EQUAL = 45;
	public static final int LIST_NOT_IN_LIST = 51;

	public static Operator getOperator(int operator) {
		switch (operator) {
		case NUMBER_EQUAL:
			return new NumberEqualOperator();
		case NUMBER_GREATER_THAN:
			return new NumberGreaterThanOperator();
		case NUMBER_LESS_THAN:
			return new NumberLessThanOperator();
		case STRING_EQUAL:
			return new StringEqualOperator();
		case STRING_NOT_EQUAL:
			return new StringNotEqualOperator();
		case STRING_IN_LIST:
			return new StringInListOperator();
		case STRING_NOT_IN_LIST:
			return new StringNotInListOperator();
		case LIST_NOT_IN_LIST:
			return new ListNotInListOperator();
		default:
			return null;
		}
	}
}
